package com.cssw.fyzb.busi.api.live;

import com.cssw.fyzb.busi.service.live.LiveService;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 关闭直播PK
 *
 * @author wondream
 */
@Function(description = "关闭直播PK", parameters = {
        @Parameter(name = "userId", type = Type.String, description = "用户标识", required = true),
        @Parameter(name = "pkId", type = Type.String, description = "关闭直播PK", required = true)
})
@Component
public class CloseLivePk implements Action {

    public static final Logger logger = LoggerFactory.getLogger(CloseLivePk.class);

    @Autowired
    LiveService liveService;

    @Override
    public Response execute(Request request) throws Exception {
        try {
            Long pkId = request.getLong("pkId");
            Long userId = request.getLong("userId");
            liveService.closeLivePk(pkId, userId);
            return Response.success("操作成功");
        } catch (Exception e){
            logger.error("", e);
            return Response.fail("操作失败");
        }
    }
}






